def currency(im, er):
    out = im * er
    return out
USD_VS_RMB = 6.77
while True:
    try:
        currencystr = input("请输入带单位的货币金额：")
        unit = currencystr[-3:]
        if unit not in ['USD','CNY']:
            raise ValueError('不支持该种货币！')
        break
    except (ValueError,IndexError):
        print('请输入正确的带货币的金额')
if unit =='CNY':
    rate = 1 / USD_VS_RMB
elif unit =='USD':
    rate = USD_VS_RMB
money = currencystr[:-3]
try:
    money = float(money)
except ValueError:
    print("请输入正确的带货币金额")
    money = 0
outmoney = currency(money,rate)
print("转换后的金额：",outmoney)

